
package com.amigo.online.common.param.result;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

/**
<code>AdvAreaInfo.java</code>
<p>

</p>
<p>
	@company Amigo
	@author LuChen
	@time 2018年12月3日 下午4:23:09
	@version 1.0 
	@lastUpdate 无
</p>
*/
public class AdvAreaInfo implements Serializable{
	
	private static final long serialVersionUID = -971965266433877068L;

	private Long id;
	
	private String name;
	
	private Long pid;
	
	private Integer sort;
	
	private Integer level;
	
	private List<AdvAreaInfo> list = new ArrayList<>();

	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Long getPid() {
		return pid;
	}

	public void setPid(Long pid) {
		this.pid = pid;
	}

	public Integer getLevel() {
		return level;
	}

	public void setLevel(Integer level) {
		this.level = level;
	}

	public List<AdvAreaInfo> getList() {
		return list;
	}

	public void setList(List<AdvAreaInfo> list) {
		this.list = list;
	}

	public Integer getSort() {
		return sort;
	}

	public void setSort(Integer sort) {
		this.sort = sort;
	}
	
	//按照排序字段排序下级list
	public void Sort() {
		this.list.sort(new Comparator<AdvAreaInfo>() {
			@Override
			public int compare(AdvAreaInfo o1, AdvAreaInfo o2) {
				int i = o1.getSort() - o2.getSort();  
                if(i == 0){  
                    return o1.getSort() - o2.getSort();  
                }  
                return i; 
			}
		});
	}

}

